/*
 * Copyright (C) 2009-2018 Hangzhou 2Dfire Technology Co., Ltd. All rights reserved
 */
package com.ws.soa.consumer.service;

import com.ws.soa.consumer.dao.mapper.UserPaymentFlowMapper;
import com.ws.soa.consumer.domain.UserPaymentFlowDO;
import com.ws.soa.consumer.util.UUIDUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * UserPaymentFlowService
 * 用户支付流水 service
 *
 * @author luobosi@2dfire.com
 * @since 2019-03-06
 */
@Service
public class UserPaymentFlowService {

    @Resource
    private UserPaymentFlowMapper userPaymentFlowMapper;

    public boolean save(UserPaymentFlowDO userPaymentFlowDO) {
        userPaymentFlowDO.setId(UUIDUtil.getUUID());
        return this.userPaymentFlowMapper.insert(userPaymentFlowDO) > 0;
    }


    /**
     * 根据用户id 查询支付流水
     *
     * @param userId 用户id
     * @return flow
     */
    public UserPaymentFlowDO findFlowByUserId(String userId) {
        return this.userPaymentFlowMapper.findFlowByUserId(userId);
    }

}
